package com.dao.c.backend.controller;

import com.dao.c.backend.common.CommonResult;
import com.dao.c.backend.entity.Category;
import com.dao.c.backend.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张幸晔
 * @since 2025-06-04
 */
@RestController
@RequestMapping("/category")
public class CategoryController {
    @Autowired private ICategoryService categoryService;

    /**
     * @param
     * @return CommonResult
     * @description 获取所有分类菜单，返回树形结构
     * @author 张幸晔
     * @date 2025-11-02 20:52
     */


    @RequestMapping("/list/tree")
    public CommonResult list() {
        return categoryService.listTree();
    }

    @RequestMapping("/list/all")
    public CommonResult listAll(){
        return categoryService.listAll();
    }

}
